<?php

namespace App\Enums\OpenShop\InvestmentPromotion;

use App\Enums\OpenShop\BaseEnum;

class UploadFileResourceEnum extends BaseEnum
{
    //todo 用户模块位置枚举 1-10
    const USER_ID_CARD_POSITIVE = 1;
    const USER_ID_CARD_BACK     = 2;
    //todo 合同模块位置枚举 11-20
    const CONTRACT_LINK          = 11;
    const CONTRACT_DOWNLOAD_LINK = 12;
    //todo 空间设计模块位置枚举 21-40 construction
    const SPACE_DESIGN_CAD_PLANE        = 21;
    const SPACE_DESIGN_PDF_PLANE        = 22;
    const SPACE_DESIGN_CAD_CONSTRUCTION = 23;
    const SPACE_DESIGN_PDF_CONSTRUCTION = 24;
    const SPACE_DESIGN_IMG              = 25;
    const SPACE_DESIGN_SOFT_XLSX        = 26;
    //todo 工程营建模块位置枚举 41-50
    const ENGINEERING_CONSTRUCTION_1 = 41;
    const ENGINEERING_CONSTRUCTION_2 = 42;
    const ENGINEERING_CONSTRUCTION_3 = 43;

    //todo 开发选址模块位置枚举 51-60
    const SELECT_LOCATION_CASH_TYPE_MAPPING = 51;

    //TODO 开店 91-100
    const START_BUSINESS_1 = 91;
    const START_SHOP_PIC   = 92;
    const START_HOT_MV     = 93;


    //todo 选址表单模块任务枚举 61-90
    const PROJECT_MESSAGE_BAIDU_HEAT_MAP          = 61; //百度地图热力图
    const SHOP_ADDRESS_LEFT_PHOTO                 = 62; //左视图
    const SHOP_ADDRESS_RIGHT_PHOTO                = 63;//右视图
    const SHOP_ADDRESS_FRONT_PHOTO                = 64;//正试图
    const SHOP_ADDRESS_SHOP_INNER_PHOTO           = 65;//店内图片
    const SHOP_ADDRESS_PANORAMA_PHOTO             = 66;//远景图
    const SHOP_ADDRESS_SHOP_VIDEO                 = 67;//视频（多选）
    const MOVING_LING_MARKING                     = 68;//动线标注
    const AFTERNOON_MARKET_PHOTO                  = 69;//午时阶段图片 最多三张
    const AFTERNOON_TEA_MARKET_PHOTO              = 70;//下午茶阶段图片 最多三张
    const NIGHT_MARKET_PHOTO                      = 71;//晚市图片 最多三张
    const NIGHT_SNACK_MARKET_PHOTO                = 72;//宵夜图片 最多三张
    const PRODUCT_SHOP_INNER_PHOTO                = 73;//分析门店照片(多张)
    const PRODUCT_SHOP_DAZHONG_PHOTO              = 74;//分析大众点评照片 多张
    const PRODUCT_SHOP_ELEM_PHOTO                 = 75;//分析饿了么照片
    const PRODUCT_SHOP_MEITUAN_PHOTO              = 76;//分析美团照片
    const BUSINESS_INFO_PHOTO                     = 77;//营业资料照片
    const BUSINESS_INFO_PDF                       = 78;// 营业资料pdf
    const THE_CASH_REGISTER_PHOTO                 = 79;// 收银机说明文档
    const CLUE_PHOTO                              = 80;//线索图片
    const PRODUCT_EAT_IN_OPEN_RECEIPT_PHOTO       = 81;//堂食开业小票
    const PRODUCT_EAT_IN_GRADUATION_RECEIPT_PHOTO = 82;//堂食结业小票
    const CLUE_VIDEO                              = 83;//线索视频
    const LICENSE_BUSINESS_PHOTO                  = 84;//营业执照照片
    const LICENSE_FOOD_PHOTO                      = 85;//食品安全许可证照片
    const DOOR_DEPTH_WIDTH_PHOTO                  = 86;//门宽进深图片
    const WALL_TAIL_USED_OLD_PHOTO                = 87;//门店内装修利旧实拍图

//    const MOVING_LINE_EXPLANATION_VIDEO = 88;//动线讲解视频
    const FLOOR_EXPLANATION_VIDEO       = 89;//楼层讲解视频
    const PERIPHERAL_VIDEO              = 90;//周边视频
    const SHOP_IN_VIDEO                 = 91;//店内视频

    const TAKE_OUT_HEATMAP              = 100;  //外卖热力图图片

    //用户模块位置枚举集合
    const USER_POSITION_LIST = [
        self::USER_ID_CARD_POSITIVE,
        self::USER_ID_CARD_BACK
    ];

    //合同模块位置枚举集合
    const CONTRACT_POSITION_LIST = [
        self::CONTRACT_LINK,
        self::CONTRACT_DOWNLOAD_LINK
    ];
    //空间设计块位置枚举集合
    const SPACE_DESIGN_POSITION_LIST = [
        self::SPACE_DESIGN_CAD_PLANE,
        self::SPACE_DESIGN_PDF_PLANE,
        self::SPACE_DESIGN_CAD_CONSTRUCTION,
        self::SPACE_DESIGN_PDF_CONSTRUCTION,
        self::SPACE_DESIGN_IMG,
        self::SPACE_DESIGN_SOFT_XLSX,
    ];

    //空间设计前端参数列表
    const  SPACE_DESIGN_DATABASE_LIST = [
        self::SPACE_DESIGN_CAD_PLANE        => "planeCad",
        self::SPACE_DESIGN_PDF_PLANE        => "planePdf",
        self::SPACE_DESIGN_CAD_CONSTRUCTION => "constructionCad",
        self::SPACE_DESIGN_PDF_CONSTRUCTION => "constructionPdf",
        self::SPACE_DESIGN_IMG              => "effectImg",
        self::SPACE_DESIGN_SOFT_XLSX        => "softOutfitXlsx",
    ];

    //开发选址位置枚举列表
    const  SELECT_LOCATION_LIST = [
        self::SELECT_LOCATION_CASH_TYPE_MAPPING
    ];

    //开发选址前端参数列表
    const  SELECT_LOCATION_DATABASE_LIST = [
        self::SELECT_LOCATION_CASH_TYPE_MAPPING => "cashTypeMapping",
    ];


    /**
     * 处理返回对应的前端接口字段
     * @param $fileList
     * @param $dataBaseEnumList
     * @return array
     */
    public static function handleFileRes($fileList, $dataBaseEnumList)
    {
        return $fileList->groupBy("position")->map(function ($v, $k) use ($dataBaseEnumList) {
            if (empty($dataBaseEnumList[$k])) {
                return;
            }

            return [
                "key" => $dataBaseEnumList[$k],
                'url' => $v->map(function ($item) {
                    if ($item->isPublic == 1) {
                        return picturePath($item->url);
                    } else {
                        return privateFilePath($item->url);
                    }
                })->values()->toArray(),
            ];
        })->values()->pluck("url", "key")->toArray();
    }

    /**
     * 处理返回对应的前端接口字段, 不存在的给空数组
     *
     * @param $fileList
     * @param $dataBaseEnumList
     * @return array
     */
    public static function handleFileResByEnum($fileList, $dataBaseEnumList)
    {
        $result = [];
        $fileList->each(function ($v) use (&$result) {
            $result[$v->position][] = $v->formatUrl;
        });

        $returnData = [];
        foreach ($dataBaseEnumList as $key => $enum) {
            $returnData[$enum] = $result[$key] ?? [];
        }
        return $returnData;
    }

    //营建映射
    const ENGINEERING_CONSTRUCTION_MAP = [
        self::ENGINEERING_CONSTRUCTION_1 => "shopHeaderImages",
        self::ENGINEERING_CONSTRUCTION_2 => "shopInnerImages",
        self::ENGINEERING_CONSTRUCTION_3 => "shopOutNightImages"
    ];

    //开店映射
    const START_BUSINESS_MAP = [
        self::START_BUSINESS_1 => "startBusinessFile",
//        self::START_SHOP_PIC   => "startShopPic",
//        self::START_HOT_MV     => 'startHotMv',
    ];

    //选址枚举位置列表
    const SITE_LOCATION_LIST = [
        self::PROJECT_MESSAGE_BAIDU_HEAT_MAP,
        self::SHOP_ADDRESS_LEFT_PHOTO,
        self::SHOP_ADDRESS_RIGHT_PHOTO,
        self::SHOP_ADDRESS_FRONT_PHOTO,
        self::SHOP_ADDRESS_SHOP_INNER_PHOTO,
        self::SHOP_ADDRESS_PANORAMA_PHOTO,
        self::SHOP_ADDRESS_SHOP_VIDEO,
        self::MOVING_LING_MARKING,
        self::LICENSE_BUSINESS_PHOTO,
        self::LICENSE_FOOD_PHOTO,
        self::DOOR_DEPTH_WIDTH_PHOTO,
        self::WALL_TAIL_USED_OLD_PHOTO,
//        self::MOVING_LINE_EXPLANATION_VIDEO,
        self::FLOOR_EXPLANATION_VIDEO,
        self::PERIPHERAL_VIDEO,
        self::SHOP_IN_VIDEO,
    ];


    const     SHOP_ADDRESS_LEFT_PHOTO_DESC        = 'leftPhoto';//左视图
    const     SHOP_ADDRESS_RIGHT_PHOTO_DESC       = 'rightPhoto';//右视图
    const     SHOP_ADDRESS_FRONT_PHOTO_DESC       = 'frontPhoto';//正试图
    const     SHOP_ADDRESS_SHOP_INNER_PHOTO_DESC  = 'innerPhoto';//店内图片
    const     SHOP_ADDRESS_PANORAMA_PHOTO_DESC    = 'panoramaPhoto';//远景图
    const     SHOP_ADDRESS_SHOP_VIDEO_DESC        = 'shopVideo';//视频（多选）
    const     BUSINESS_INFO_PHOTO_DESC            = 'infoPhoto';
    const     BUSINESS_INFO_PDF_DESC              = 'infoPdf';
    const     PROJECT_MESSAGE_BAIDU_HEAT_MAP_DESC = 'heatMap';
    const     MOVING_LING_MARKING_DESC            = 'lineMarking';
    const     THE_CASH_REGISTER_PHOTO_DESC        = 'cashInfoPhoto';
    const     WALL_TAIL_USED_OLD_PHOTO_DESC       = 'wallTileUsedOldPhoto';
    const     DOOR_DEPTH_WIDTH_PHOTO_DESC         = 'doorDepthWidthPhoto';

    //图片视频-前端字段映射
    const UPLOAD_FILE_DATABASE_LIST = [
        self::PROJECT_MESSAGE_BAIDU_HEAT_MAP => 'heatMap',
        self::SHOP_ADDRESS_LEFT_PHOTO        => 'leftPhoto',
        self::SHOP_ADDRESS_RIGHT_PHOTO       => 'rightPhoto',
        self::SHOP_ADDRESS_FRONT_PHOTO       => 'frontPhoto',
        self::SHOP_ADDRESS_SHOP_INNER_PHOTO  => 'innerPhoto',
        self::SHOP_ADDRESS_PANORAMA_PHOTO    => 'panoramaPhoto',
        self::SHOP_ADDRESS_SHOP_VIDEO        => 'shopVideo',
        self::MOVING_LING_MARKING            => 'lineMarking'
    ];

    //选址枚举位置列表-前端映射
    const  SITE_LOCATION_DATABASE_LIST = [
        self::SHOP_ADDRESS_LEFT_PHOTO        => 'leftPhoto', //左视图
        self::SHOP_ADDRESS_RIGHT_PHOTO       => 'rightPhoto',//右视图
        self::SHOP_ADDRESS_FRONT_PHOTO       => 'frontPhoto',//正试图
        self::SHOP_ADDRESS_SHOP_INNER_PHOTO  => 'innerPhoto',//店内图片
        self::SHOP_ADDRESS_PANORAMA_PHOTO    => 'panoramaPhoto',//远景图
        self::SHOP_ADDRESS_SHOP_VIDEO        => 'shopVideo',//视频（多选）
        self::BUSINESS_INFO_PHOTO            => 'infoPhoto',
        self::BUSINESS_INFO_PDF              => 'infoPdf',
        self::PROJECT_MESSAGE_BAIDU_HEAT_MAP => 'heatMap',
        self::MOVING_LING_MARKING            => 'lineMarking',
        self::THE_CASH_REGISTER_PHOTO        => 'cashInfoPhoto',
        self::LICENSE_BUSINESS_PHOTO         => 'historyBusinessLicensePhoto',
        self::LICENSE_FOOD_PHOTO             => 'historyFoodLicensePhoto',
        self::DOOR_DEPTH_WIDTH_PHOTO         => 'doorDepthWidthPhoto',
        self::WALL_TAIL_USED_OLD_PHOTO       => 'wallTileUsedOldPhoto',
//        self::MOVING_LINE_EXPLANATION_VIDEO  => "movingLineExplanationVideo",
        self::FLOOR_EXPLANATION_VIDEO        => "floorExplanationVideo",
        self::PERIPHERAL_VIDEO               => "peripheralVideo",
        self::SHOP_IN_VIDEO                  => "shopInVideo",
    ];

    const SITE_LOCATION_PHOTO_LIST = [
        self::SHOP_ADDRESS_LEFT_PHOTO       => 'leftPhoto', //左视图
        self::SHOP_ADDRESS_RIGHT_PHOTO      => 'rightPhoto',//右视图
        self::SHOP_ADDRESS_FRONT_PHOTO      => 'frontPhoto',//正试图
        self::SHOP_ADDRESS_SHOP_INNER_PHOTO => 'innerPhoto',//店内图片
        self::SHOP_ADDRESS_PANORAMA_PHOTO   => 'panoramaPhoto',//远景图
        self::SHOP_ADDRESS_SHOP_VIDEO       => 'shopVideo',//视频（多选）
    ];

    const SITE_LOCATION_PHOTO_TEXT = [
        self::SHOP_ADDRESS_LEFT_PHOTO       => '左视图',
        self::SHOP_ADDRESS_RIGHT_PHOTO      => '右视图',
        self::SHOP_ADDRESS_FRONT_PHOTO      => '正视图',
        self::SHOP_ADDRESS_SHOP_INNER_PHOTO => '店内图片',
        self::SHOP_ADDRESS_PANORAMA_PHOTO   => '远景图',
        self::SHOP_ADDRESS_SHOP_VIDEO       => '视频',
    ];

    //客群分析
    const CUSTOMER_ANALYSIS_LIST = [
        self::AFTERNOON_MARKET_PHOTO,
        self::AFTERNOON_TEA_MARKET_PHOTO,
        self::NIGHT_MARKET_PHOTO,
        self::NIGHT_SNACK_MARKET_PHOTO,
    ];

    //客群分析-前端字段映射
    const CUSTOMER_ANALYSIS_DATABASE_LIST = [
        self::AFTERNOON_MARKET_PHOTO     => 'afternoonPhoto',//午时阶段图片 最多三张
        self::AFTERNOON_TEA_MARKET_PHOTO => 'afternoonTeaPhoto',//下午茶阶段图片 最多三张
        self::NIGHT_MARKET_PHOTO         => 'nightPhoto',//晚市图片 最多三张
        self::NIGHT_SNACK_MARKET_PHOTO   => 'nightSnackPhoto',//宵夜图片 最多三张
    ];

    //竞品分析-列表
    const PRODUCT_ANALYSIS_LIST = [
        self::PRODUCT_SHOP_INNER_PHOTO,
        self::PRODUCT_SHOP_DAZHONG_PHOTO,
        self::PRODUCT_SHOP_ELEM_PHOTO,
        self::PRODUCT_SHOP_MEITUAN_PHOTO,
        self::PRODUCT_EAT_IN_GRADUATION_RECEIPT_PHOTO
    ];

    //竞品分析-前端字段映射
    const PRODUCT_ANALYSIS_DATABASE_LIST = [
        self::PRODUCT_SHOP_INNER_PHOTO                => 'shopInnerPhoto',//午时阶段图片 最多三张
        self::PRODUCT_SHOP_DAZHONG_PHOTO              => 'dazhongPhoto',//下午茶阶段图片 最多三张
        self::PRODUCT_SHOP_ELEM_PHOTO                 => 'elemPhoto',//晚市图片 最多三张
        self::PRODUCT_SHOP_MEITUAN_PHOTO              => 'meituanPhoto',//宵夜图片 最多三张
        self::PRODUCT_EAT_IN_GRADUATION_RECEIPT_PHOTO => "eatInGraduationReceiptPhoto",//堂食结业小票
    ];

    const CLUE_SITE_LOCATION_MAP = [
        self::CLUE_PHOTO => "clueImages",
        self::CLUE_VIDEO => "clueVideos"
    ];

    /** 证书资源 **/
    const LICENSE_MAP = [
        self::LICENSE_BUSINESS_PHOTO => "historyBusinessLicensePhoto",
        self::LICENSE_FOOD_PHOTO     => "historyFoodLicensePhoto"
    ];
}
